const { param } = require('express-validator')
const validate = require('../middleware/validate')
exports.addUpload = validate([
  param('type').notEmpty().withMessage('上传类型不能为空'),
  param('type').custom(async (value) => {
    const allUploadType = ['avatar', 'cover','navigation','article']
    if (!allUploadType.includes(value)) {
      return Promise.reject(`上传类型${value}不正确`)
    }
    return true
  }),
])
